package com.changgou.search.pojo;


import org.springframework.data.elasticsearch.annotations.Field;
import org.springframework.data.elasticsearch.annotations.FieldType;

import javax.persistence.Id;
import java.io.Serializable;
import java.util.Date;
import java.util.Map;

/**
 * 这个类与索引库相对应的索引进行映射的,我们可以操作这个类,来达到对索引库的改变
 */
public class SkuInfo implements Serializable {
  //商品id，同时也是商品编号.  是es包下的
  @Id
  @Field(index = true, store = true, type = FieldType.Keyword)
  private Long id;
  //SKU名称
  @Field(index = true, store = true, type = FieldType.Text, analyzer =
      "ik_smart")
  private String name;
  //商品价格，单位为：元
  @Field(index = true, store = true, type = FieldType.Double)
  private Long price;
  //库存数量
  @Field(index = true, store = true, type = FieldType.Integer)
  private Integer num;
  //商品图片
  @Field(index = false, store = true, type = FieldType.Text)
  private String image;
  //商品状态，1-正常，2-下架，3-删除
  @Field(index = true, store = true, type = FieldType.Keyword)
  private String status;
  //创建时间
  private Date createTime;
  //更新时间
  private Date updateTime;
  //是否默认
  @Field(index = true, store = true, type = FieldType.Keyword)
  private String isDefault;
  //SPUID
  @Field(index = true, store = true, type = FieldType.Long)
  private Long spuId;
  //类目ID
  @Field(index = true, store = true, type = FieldType.Long)
  private Long categoryId;
  //类目名称
  @Field(index = true, store = true, type = FieldType.Keyword)
  private String categoryName;
  //品牌名称
  @Field(index = true, store = true, type = FieldType.Keyword)
  private String brandName;
  //规格
  //规格参数
  private Map<String, Object> specMap;
}
